package com.stylefeng.guns.modular.system.warpper;

import com.stylefeng.guns.core.base.warpper.BaseControllerWarpper;
import com.stylefeng.guns.core.common.constant.factory.ConstantFactory;
import com.stylefeng.guns.core.util.ToolUtil;

import java.util.Map;

/**
 * @author liuxin
 * @see
 * @since 1.0.0
 **/
public class ProductCateWrapper extends BaseControllerWarpper {

    public ProductCateWrapper(Object list) {
        super(list);
    }

    @Override
    protected void warpTheMap(Map<String, Object> map) {
        Long pid = Long.valueOf(map.get("parent_id")+"");

        if (ToolUtil.isEmpty(pid) || 0 == pid) {
            map.put("pName", "--");
        } else {
            map.put("pName", ConstantFactory.me().getProductCateName(pid));
        }
    }
}
